package Third;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class Main {
    public static void main(String[] args) {
        Random random = new Random();

        List<String> list = new ArrayList<>();

        String[] color = {"草花", "方片", "红桃", "黑桃"};
        String[] number = {"K", "Q", "J", "10", "9", "8", "7", "6", "5", "4", "3","2","A"};


        for (String s : color) {
            for (String string : number) {
                list.add(s + string);
            }
        }
        list.add("大王");
        list.add("小王");

        List<String> A =  new ArrayList<>();
        List<String> B =  new ArrayList<>();
        List<String> C =  new ArrayList<>();

        List[] players = new List[]{A,B,C};

        for (int i = 0; i < list.size(); i++) {
            int j = random.nextInt(54);
            String s = list.get(i);
            list.set(i, list.get(j));
            list.set(j, s);
        }

        int n = 0;
        while(n < 51){
            for (int i = 0; i < players.length; i++) {
                players[i].add(list.get(i));
                n++;
            }
        }


        int[] identity = new int[]{0,0,0};
        int a = random.nextInt(2);
        identity[a] = 1;

        for (int j = 51; j < 54; j++) {
            players[a].add(list.get(j));
        }

        for (int i = 0; i < players.length; i++){
            if(identity[i] == 0){
                System.out.print("农民" + ":");
            }else {
                System.out.print("地主" + ":");
            }
            for (int j = 0; j < players[i].size(); j++){
                System.out.print(players[i].get(j) + " ");
            }
            System.out.println();
        }


    }

}
